<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/22
 * Time: 9:56 AM
 */

namespace common\sources\write\buyprincipalcash;

use Yii;
use common\models\craftsman\BuyprincipalCash;

class BuyPrincipalCashAccess implements IBuyPrincipalCashAccess {
	public function modifyPepperCash($data) {
		$sql = 'UPDATE ' . BuyprincipalCash::tableName() . ' SET reason = :reason,status = :status,update_time=:update_time WHERE id = :id ';
		return Yii::$app->db->createCommand($sql)
			->bindValues([
				':reason'      => $data['reason'],
				':status'      => $data['status'],
				':update_time' => time(),
				':id'          => $data['id']
			])->execute();
	}


	// 提现审核 修改
	public function newModifyPepperCash1($data) {
		$sql = 'UPDATE ' . BuyprincipalCash::tableName() . ' SET reason = :reason,status = :status,update_time=:update_time,auditor_time=:auditor_time,auditor_user=:auditor_user WHERE id = :id ';
		return Yii::$app->db->createCommand($sql)
			->bindValues([
				':reason'       => $data['reason'],
				':status'       => $data['status'],
				':update_time'  => time(),
				':auditor_time' => time(),
				':auditor_user' => $data['operator'],
				':id'           => $data['id']
			])->execute();
	}

	// 提现完成
	public function newModifyPepperCash($data) {
		$sql = 'UPDATE ' . BuyprincipalCash::tableName() . ' SET reason = :reason,status = :status,update_time=:update_time,end_time=:end_time,end_user=:end_user,kq_serial_number=:kq_serial_number WHERE id = :id ';
		return Yii::$app->db->createCommand($sql)
			->bindValues([
				':reason'           => $data['reason'],
				':status'           => $data['status'],
				':update_time'      => time(),
				':end_time'         => time(),
				':end_user'         => $data['operator'],
				':kq_serial_number' => $data['kq_serial_number'],
				':id'               => $data['id']
			])->execute();
	}
}